package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.NewWorkOrder;
import com.ruoyi.system.mapper.NewWorkOrderMapper;
import com.ruoyi.system.service.INewWorkOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 工作工单Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-30
 */
@Service
public class NewWorkOrderServiceImpl implements INewWorkOrderService 
{
    @Autowired
    private NewWorkOrderMapper newWorkOrderMapper;

    /**
     * 查询工作工单
     * 
     * @param id 工作工单主键
     * @return 工作工单
     */
    @Override
    public NewWorkOrder selectNewWorkOrderById(Long id)
    {
        return newWorkOrderMapper.selectNewWorkOrderById(id);
    }

    /**
     * 查询工作工单列表
     * 
     * @param newWorkOrder 工作工单
     * @return 工作工单
     */
    @Override
    public List<NewWorkOrder> selectNewWorkOrderList(NewWorkOrder newWorkOrder)
    {
        return newWorkOrderMapper.selectNewWorkOrderList(newWorkOrder);
    }

    /**
     * 新增工作工单
     * 
     * @param newWorkOrder 工作工单
     * @return 结果
     */
    @Override
    public int insertNewWorkOrder(NewWorkOrder newWorkOrder)
    {
        newWorkOrder.setCreateTime(DateUtils.getNowDate());
        return newWorkOrderMapper.insertNewWorkOrder(newWorkOrder);
    }

    /**
     * 修改工作工单
     * 
     * @param newWorkOrder 工作工单
     * @return 结果
     */
    @Override
    public int updateNewWorkOrder(NewWorkOrder newWorkOrder)
    {
        newWorkOrder.setUpdateTime(DateUtils.getNowDate());
        return newWorkOrderMapper.updateNewWorkOrder(newWorkOrder);
    }

    /**
     * 批量删除工作工单
     * 
     * @param ids 需要删除的工作工单主键
     * @return 结果
     */
    @Override
    public int deleteNewWorkOrderByIds(Long[] ids)
    {
        return newWorkOrderMapper.deleteNewWorkOrderByIds(ids);
    }

    /**
     * 删除工作工单信息
     * 
     * @param id 工作工单主键
     * @return 结果
     */
    @Override
    public int deleteNewWorkOrderById(Long id)
    {
        return newWorkOrderMapper.deleteNewWorkOrderById(id);
    }
}
